﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RST
{
    public partial class Diagnosis : BaseRST
    {
        protected override Model.RST<T> GetRSTObject<T>(string Action, object Query)
        {
            return GetRSTObject<T>("Diagnosis", Action, Query);
        }

        public Model.Diagnosis Insert(Model.Diagnosis Diagnosis)
        {
            Model.RST<Model.Diagnosis> rsp = GetRSTObject<Model.Diagnosis>("insert", Diagnosis);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                return rsp.RSTData;
            }
            return null;
        }

        public Model.Diagnosis Single(Model.Diagnosis Diagnosis)
        {
            Model.RST<Model.Diagnosis> rsp = GetRSTObject<Model.Diagnosis>("single", Diagnosis);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                return rsp.RSTData;
            }
            return null;
        }

        public bool Delete(Model.Diagnosis Diagnosis)
        {
            Model.RST<int> rsp = GetRSTObject<int>("delete", Diagnosis);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                return rsp.RSTData > 0 ? true : false;
            }
            return false;
        }

        public bool Update(Model.Diagnosis Diagnosis)
        {
            Model.RST<int> rsp = GetRSTObject<int>("update", Diagnosis);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                return rsp.RSTData > 0 ? true : false;
            }
            return false;
        }

        public List<Model.Diagnosis> List(Model.Search.DiagnosisList dl)
        {
            Model.RST<List<Model.Diagnosis>> rsp = GetRSTObject<List<Model.Diagnosis>>("arraylist", dl);
            if (rsp.RSTCode == Model.RSTStatusCode.OK)
            {
                return rsp.RSTData;
            }
            return null;
        }
    }
}
